<template>
  <div>
    <addOrEdit
      :ref="e => createRef(e, 'editStudentRef')"
      @close="handleClose"
      @success="sumbitSuccess"
    >
    </addOrEdit>
  </div>
</template>
  
<script lang="ts" setup>
import { nextTick } from 'vue';
import { useRouter } from 'vue-router'
import addOrEdit from './components/addOrEdit.vue'
import { refs, createRef } from 'dsrz/utils'
import { useResetReactive } from 'dsrz/hooks/useReset'

defineOptions({
  name: 'editStudentPage',
})

const {
  params,
  exposes: { query },
} = useResetReactive({})

const router = useRouter()
const handleClose = () => { 
  router.back()
}
const sumbitSuccess = async () => await query()

nextTick(() => {
  refs.editStudentRef.getParams(history.state.params)
})
</script>
  
<style lang="scss" scoped></style>